<template>
  <div>
    <div class="wp">
      <div class="m-boxl1">
        <div class="m-inreviewl styll1">
          <div class="tit">申请成为 SilentBerry 作者</div>
          <div class="m-forml1">
            <a-form >
              <a-form-item
                label="作者名字"
                class="keynote"
              >
                <a-input v-model:value="formState.name" class="inp" placeholder="请输入名字" />
              </a-form-item>
              <a-form-item
                label="作者姓氏"
                class="keynote"
              >
                <a-input v-model:value="formState.surname" class="inp" placeholder="请输入姓氏" />
              </a-form-item>
              <a-form-item
                label="联系邮箱"
                class="keynote"
              >
                <a-input v-model:value="formState.email" class="inp" placeholder="请输入联系邮箱" />
              </a-form-item>
              <a-form-item label="身份" class="keynote">
                <a-select
                  ref="select"
                   placeholder="请选择身份"
                  v-model:value="formState.identity"
                  style="width: 360px"
                >
                <a-select-option value="AUTHOR">AUTHOR</a-select-option>
                <a-select-option value="AUTHOR_BROKER">AUTHOR_BROKER</a-select-option>
                <a-select-option value="COPYRIGHT_OWNER">COPYRIGHT_OWNER</a-select-option>
                <a-select-option value="INSTITUTION">INSTITUTION</a-select-option>
                <a-select-option value="INVITEE">INVITEE</a-select-option>
                </a-select>
              </a-form-item>
              <a-form-item label="作者简介">
                <div class="text">
                  <a-textarea v-model:value="formState.abstract" class="textarea" placeholder="简单介绍您个人能够提供的书籍或者能力"/>
                  <div class="num">0/2000</div>
                </div>
              </a-form-item>
              <!-- <a-form-item label="创作内容链接" class="keynote">
                <div class="text">
                  <a-textarea v-model:value="formState.booksUrl" class="textarea" placeholder="请输入作品链接" />
                </div>
              </a-form-item> -->
              <a-form-item>
                <div class="g-btnl">
                  <a-button type="primary" html-type="submit" class="btn" @click="save()">提交申请</a-button>
                </div>
              </a-form-item>
            </a-form>
          </div>
        </div>
      </div>   
    </div>

    <!-- 温馨提示 -->
    <a-modal
      class="m-modall1"
      v-model:visible="visible"
      centered
      :width="562"
      :footer="null"
    >
    
      <div class="m-tipsl">
        <div class="tit">温馨提示</div>
        <div class="tips">入驻申请已提交，我们会在{{auditDays}}个工作日内处理您的申请，审核通过后系统会自动向你的邮箱发送邮件通知！</div>
        <div class="btnbox">
          <div class="btn" @click="visible = false">关闭</div>
        </div>
      </div>
    </a-modal>
    <!-- 温馨提示end -->
  </div>
</template>
<script setup>

import { reactive, ref, onMounted } from 'vue';
import request from '~/services/request'
import { message } from 'ant-design-vue';
import {RouterLink, RouterView, useRouter} from 'vue-router'
const router = useRouter()
const isWritten =ref('0')
const auditDays =ref(0)
const formState = reactive({
  name: '',
  surname:'',
  email: '',
  identity:'AUTHOR',      
  abstract:'',
});
function save(){
  // formState.isWritten1==1?formState.isWritten=false:formState.isWritten=true
  request.api_author(formState).then((res=>{
    auditDays.value=res.auditDays
    visible.value = true
}))
}
// 二维码弹窗
const visible = ref(false);
onMounted(() => {
  //visible.value = true
});
</script>